home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / ksslpeerinfo.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  2.6 KB  |  109 lines

  1. /* This file is part of the KDE project
  2.  *
  3.  * Copyright (C) 2000-2003 George Staikos <staikos@kde.org>
  4.  *
  5.  * This library is free software; you can redistribute it and/or
  6.  * modify it under the terms of the GNU Library General Public
  7.  * License as published by the Free Software Foundation; either
  8.  * version 2 of the License, or (at your option) any later version.
  9.  *
  10.  * This library is distributed in the hope that it will be useful,
  11.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.  * Library General Public License for more details.
  14.  *
  15.  * You should have received a copy of the GNU Library General Public License
  16.  * along with this library; see the file COPYING.LIB.  If not, write to
  17.  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  18.  * Boston, MA 02110-1301, USA.
  19.  */
  20.  
  21. #ifndef _KSSLPEERINFO_H
  22. #define _KSSLPEERINFO_H
  23.  
  24. class KSSL;
  25.  
  26. #include <qglobal.h>
  27. #include <qstringlist.h>
  28. #include <ksslcertificate.h>
  29.  
  30. class KSSLPeerInfoPrivate;
  31. class KInetSocketAddress;
  32.  
  33. /**
  34.  * KDE SSL Peer Data
  35.  *
  36.  * This class contains data about the peer of an SSL connection.
  37.  *
  38.  * @author George Staikos <staikos@kde.org>
  39.  * @see KSSL
  40.  * @short KDE SSL Peer Data
  41.  */
  42. class KIO_EXPORT KSSLPeerInfo {
  43. friend class KSSL;
  44. public:
  45.     /**
  46.      *  Destroy this instance
  47.      */
  48.     ~KSSLPeerInfo();
  49.  
  50.     /**
  51.      *  Get a reference to the peer's certificate
  52.      *
  53.      *  @return a reference to the peer's certificate
  54.      *  @see KSSLCertificate
  55.      */
  56.     KSSLCertificate& getPeerCertificate();
  57.  
  58.     /**
  59.      *  Determine if the peer's certificate matches the address set with
  60.      *  setPeerHost().  Note that this is a match in the "https"
  61.      *  sense, taking into account, for instance,  wildcards.
  62.      * 
  63.      *  @return true if it matches
  64.      *  @see setPeerHost
  65.      */
  66.     bool certMatchesAddress();
  67.  
  68.     /**
  69.      *  Determine if the given "common name" matches the address set with
  70.      *  setPeerHost().  Note that this is a match in the "https"
  71.      *  sense, taking into account, for instance,  wildcards.
  72.      * 
  73.      *  @return true if it matches
  74.      *  @see setPeerHost
  75.      */
  76.     bool cnMatchesAddress(QString cn);
  77.  
  78.     /**
  79.      *  Set the host that we are connected to.  This is generally set by
  80.      *  KSSL, and should be exactly what the user -thinks- he is connected
  81.      *  to.  (for instance, the host name in the url)
  82.      *
  83.      *  @param host the hostname
  84.      */
  85.     void setPeerHost(QString host = QString::null);
  86.  
  87.     /**
  88.      *  Returns the host we are connected to.
  89.      */
  90.     const QString& peerHost() const;
  91.  
  92.     /**
  93.      *  Clear out the host name.
  94.      */
  95.     void reset();
  96.  
  97. protected:
  98.     KSSLPeerInfo();
  99.  
  100.     KSSLCertificate m_cert;
  101.  
  102. private:
  103.     KSSLPeerInfoPrivate *d;
  104. };
  105.  
  106.  
  107. #endif
  108.  
  109.